home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20021006-20030409
/
000310_fdc@columbia.edu_Sat Feb 15 15:29:16 EST 2003.msg
< prev
next >
Wrap
Text File
|
2003-04-08
|
4KB
|
117 lines
Article: 14106 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
From: fdc@columbia.edu (Frank da Cruz)
Newsgroups: comp.unix.admin,comp.unix.programmer,comp.protocols.kermit.misc
Subject: Re: Listing Files with full date
Date: 15 Feb 2003 15:24:56 -0500
Organization: Columbia University
Lines: 100
Message-ID: <b2m7mo$qil$1@watsol.cc.columbia.edu>
References: <b2ja2g$pq3$2@reader1.panix.com> <v4r81bm1h4vh35@corp.supernews.com>
NNTP-Posting-Host: watsol.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1045340697 15990 128.59.39.139 (15 Feb 2003 20:24:57 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 15 Feb 2003 20:24:57 GMT
Xref: newsmaster.cc.columbia.edu comp.unix.admin:148899 comp.unix.programmer:158863 comp.protocols.kermit.misc:14106
Jane O <janeohin@aol.com> wrote:
> How can I list files so that the "year" shows up instead of just
> Month, day, time
> 16757 Feb 10 15:44 abc.proc*
> 9435 Jan 24 13:29 def.proc*
> 8639 Jan 30 13:23 xyz.proc
>
Believe it or not, you can use Kermit for this; it has a rather
featureful DIRECTORY command. Here's a small directory as seen
by ls -lG:
$ ls -lG
total 124
-rw-rw---- 1 fdc 2962 Dec 22 1999 archive.txt
-rw-rw---- 1 fdc 5934 Jan 12 1990 ascii.tbl
-rw-rw---- 1 fdc 15317 Sep 20 2000 sail.txt
-rw-rw---- 1 fdc 89237 Aug 2 1988 yacc.txt
-rw-rw---- 1 fdc 2180 Feb 8 15:29 webpages.txt
$
And as seen by Kermit:
C-Kermit> dir
-rw-rw---- 2962 1999-12-22 15:08:34 archive.txt
-rw-rw---- 5934 1990-01-12 14:17:47 ascii.tbl
-rw-rw---- 15317 2000-09-20 10:55:31 sail.txt
-rw-rw---- 89237 1988-08-02 21:22:02 yacc.txt
-rw-rw---- 2180 2003-02-08 15:29:48 webpages.txt
C-Kermit>
The dates are yyyy-mm-dd by default, but if you wish you show them
the "English" way:
C-Kermit> dir /englishdate
-rw-rw---- 2962 22-Dec-1999 15:08:34 archive.txt
-rw-rw---- 5934 12-Jan-1990 14:17:47 ascii.tbl
-rw-rw---- 2180 8-Feb-2003 15:29:48 webpages.txt
-rw-rw---- 15317 20-Sep-2000 10:55:31 sail.txt
-rw-rw---- 89237 2-Aug-1988 21:22:02 yacc.txt
C-Kermit>
You can sort them by date:
C-Kermit> dir /sort:date
-rw-rw---- 89237 1988-08-02 21:22:02 yacc.txt
-rw-rw---- 5934 1990-01-12 14:17:47 ascii.tbl
-rw-rw---- 2962 1999-12-22 15:08:34 archive.txt
-rw-rw---- 15317 2000-09-20 10:55:31 sail.txt
-rw-rw---- 2180 2003-02-08 15:29:48 webpages.txt
C-Kermit>
Or in reverse order by date:
C-Kermit> dir /sort:date /reverse
-rw-rw---- 2180 2003-02-08 15:29:48 webpages.txt
-rw-rw---- 15317 2000-09-20 10:55:31 sail.txt
-rw-rw---- 2962 1999-12-22 15:08:34 archive.txt
-rw-rw---- 5934 1990-01-12 14:17:47 ascii.tbl
-rw-rw---- 89237 1988-08-02 21:22:02 yacc.txt
C-Kermit>
(or by size, or by name, etc). You can write the results to a file,
store it in an array, etc. There are tons more options too:
C-Kermit> dir ? Enter or Return to confirm the command, or
file specification, or switch, one of the following:
/after: /dotfiles /message: /nosort /smaller-than:
/all /englishdate /nobackupfiles /not-after: /sort:
/array: /except: /nodotfiles /not-before: /summary
/ascending /files /nofollowlinks /noxfermode /type:
/backup /heading /noheading /output: /xfermode
/before: /isodate /nomessage /page /verbose
/brief /larger-than: /nopage /recursive
/directories /followlinks /norecursive /reverse
C-Kermit>
("help directory" for details). Many of these same options are available
on other file-related commands such as SEND, GET, DELETE, etc. So, to
answer the commonly asked question, "How do I delete files that are more
than five days old?":
C-Kermit> delete /before:-5days *
: > I need to compare the files dates !
:
Kermit has a command for this:
if newer <file1> <file2> <command>
It also has all sorts of date conversion, comparison, and arithmetic
functions:
http://www.columbia.edu/kermit/ckermit80.html#x8.13
You can find Kermit here:
http://www.columbia.edu/kermit/
- Frank